# 编写一个函数，接受一个参数n，n为正整数，上下三角两种打印方式。要求数字必须对齐
def shang(n):
    for i in range(1,n):
        a = ''
        if i == 1:
            print("{:>26}".format(1))
        for j in range(1,i+2):
            a = str(j) + ' ' + a
        print("{:>27}".format(a))
shang(12)

print()
def xia(n):
    b = " ".join([str(i) for i in range(n, 0, -1)])
    width = len(b)
    for i in range(n, 0 ,-1):
        print("{:>{}}".format(' '.join([str(j) for j in range(i, 0, -1)]),width))
xia(12)


# 正三角，你要是打印15的话，你试试
